package com.cloud.code.牛客网;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * 反转单词
 *
 */
public class Test29 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String line = scanner.nextLine();
            System.out.println(line);

            String[] split = line.split(" ");
            List<String> list = Arrays.asList(split);
            Collections.reverse(list);

            System.out.println(String.join(" ",list));
        }
    }
}
